import request from "@/api/request.ts";
// 获取下拉菜单
export const getMenuTree = (): Promise<apiServerResponse> => {
  return request({
    url: "/sysMenu/menuSelectTree",
    method: "GET",
  });
};

// 获取系统菜单
export const getMenuList = (
  params: SysMenuEntityRequestParams
): Promise<apiServerResponse> => {
  return request({
    url: "/sysMenu/menuList",
    method: "GET",
    params,
  });
};

// 新增系统菜单
export const addMenu = (data: SysMenuEntity): Promise<apiServerResponse> => {
  return request({
    url: "/sysMenu/add",
    method: "POST",
    data,
  });
};

// 修改系统菜单
export const updateMenu = (data: SysMenuEntity): Promise<apiServerResponse> => {
  return request({
    url: "/sysMenu/update",
    method: "PUT",
    data,
  });
};

// 删除系统菜单
export const removeMenuById = (id: string): Promise<apiServerResponse> => {
  return request({
    url: `/sysMenu/deleteById/${id}`,
    method: "DELETE",
  });
};
